data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1193.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9464 -0.3479 -0.0901 0.1832 5.6340
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.00000127 0.001127
## Residual 0.00001400 0.003741
## Number of obs: 178, groups: stateID, 33
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0101625431 0.0096461051 67.4091819386
## Affluence 0.0047355148 0.0011186418 99.1444625092
## Singletons.in.Tract 0.0014639303 0.0009213236 139.3445969200
## Seniors.in.Tract 0.0008853489 0.0012102208 148.6380024753
## African.Americans.in.Tract 0.0005927335 0.0010163699 150.8947551957
## Noncitizens.in.Tract 0.0009039769 0.0007848329 126.6001382084
## High.BP 0.0001920554 0.0001913059 108.3638445796
## Binge.Drinking 0.0001465824 0.0001585600 40.7864655196
## Cancer -0.0009292047 0.0011120054 97.4697709685
## Asthma 0.0006765186 0.0005596267 39.7588383820
## Heart.Disease 0.0011067513 0.0013182362 71.7051231099
## COPD -0.0001480712 0.0010913908 74.2123187620
## Smoking -0.0000934126 0.0002291567 77.8719033880
## Diabetes -0.0005659314 0.0005403132 79.1778221150
## No.Physical.Activity -0.0000136879 0.0002069196 87.1565579792
## Obesity 0.0002401006 0.0001788037 95.2115962596
## Poor.Sleeping.Habits -0.0000100415 0.0001670882 122.1881581737
## Poor.Mental.Health -0.0000738256 0.0004188868 30.4092909367
## Testing_Rate 0.0000005249 0.0000002843 34.1444000861
## Hospitalization_Rate -0.0000946979 0.0000899134 26.9871466499
## t value Pr(>|t|)
## (Intercept) -1.054 0.2959
## Affluence 4.233 0.0000515 ***
## Singletons.in.Tract 1.589 0.1143
## Seniors.in.Tract 0.732 0.4656
## African.Americans.in.Tract 0.583 0.5606
## Noncitizens.in.Tract 1.152 0.2516
## High.BP 1.004 0.3177
## Binge.Drinking 0.924 0.3607
## Cancer -0.836 0.4054
## Asthma 1.209 0.2339
## Heart.Disease 0.840 0.4039
## COPD -0.136 0.8924
## Smoking -0.408 0.6847
## Diabetes -1.047 0.2981
## No.Physical.Activity -0.066 0.9474
## Obesity 1.343 0.1825
## Poor.Sleeping.Habits -0.060 0.9522
## Poor.Mental.Health -0.176 0.8613
## Testing_Rate 1.846 0.0736 .
## Hospitalization_Rate -1.053 0.3016
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.135
## Sngltns.n.T 0.019 0.077
## Snrs.n.Trct 0.568 0.379 0.193
## Afrcn.Am..T 0.157 0.147 -0.410 0.138
## Nnctzns.n.T -0.002 0.106 0.044 0.068 -0.078
## High.BP -0.003 0.243 0.067 0.114 -0.095 0.399
## Bing.Drnkng -0.284 -0.194 -0.298 -0.191 0.077 0.041 0.136
## Cancer -0.588 -0.198 0.180 -0.327 -0.073 -0.143 -0.381 -0.114
## Asthma -0.365 -0.209 -0.237 -0.183 0.091 0.096 0.169 -0.002 0.042
## Heart.Dises -0.148 0.075 -0.288 -0.151 0.249 -0.105 -0.015 0.059 -0.472
## COPD 0.564 0.041 0.136 0.279 -0.008 0.285 0.184 0.111 -0.270
## Smoking -0.173 0.139 -0.169 -0.105 -0.059 -0.003 -0.070 -0.298 0.091
## Diabetes 0.072 -0.340 -0.107 -0.228 -0.308 -0.329 -0.526 0.044 0.242
## N.Physcl.Ac -0.176 -0.054 0.077 -0.035 -0.033 -0.219 -0.116 0.105 0.479
## Obesity 0.005 0.429 0.422 0.304 0.143 0.199 -0.084 -0.239 0.111
## Pr.Slpng.Hb -0.458 -0.404 0.142 -0.362 -0.360 -0.018 -0.190 0.092 0.142
## Pr.Mntl.Hlt -0.335 0.260 -0.060 -0.069 0.100 -0.179 -0.077 0.059 0.315
## Testing_Rat 0.168 -0.083 -0.026 0.012 0.043 -0.105 -0.014 0.006 -0.172
## Hsptlztn_Rt -0.131 -0.228 -0.120 -0.221 -0.039 -0.135 -0.139 -0.130 0.047
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.279
## COPD -0.377 -0.561
## Smoking 0.078 0.205 -0.516
## Diabetes -0.119 -0.287 -0.111 0.238
## N.Physcl.Ac 0.008 -0.384 -0.008 -0.329 -0.060
## Obesity -0.274 -0.096 0.166 -0.199 -0.395 -0.063
## Pr.Slpng.Hb 0.069 0.251 -0.205 0.006 -0.011 -0.115 -0.168
## Pr.Mntl.Hlt -0.237 0.086 -0.446 0.086 0.026 0.055 0.095 -0.187
## Testing_Rat -0.351 -0.034 0.184 0.151 0.116 -0.302 0.099 -0.112 -0.098
## Hsptlztn_Rt 0.047 0.087 -0.111 0.098 0.099 -0.048 -0.043 0.005 -0.054
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.258
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)